• view_stock_availability.php
  • project /
1 <?php
2 session_start();
// Use session variable on this page. This function must put on the top of page.
3 if
(!isset($_SESSION['username']) || $_SESSION['usertype'] !='admin'){ // if session variable "username" does not exist.
4 header(
"location:index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php
5 }

6 else

7 {
8     include_once
"db.php";
9     error_reporting (E_ALL ^ E_NOTICE);
10
11
12 ?><!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
13 "http:
//www.w3.org/TR/html4/loose.dtd">
14 <html>
15 <head>
16 <title>Welcome to Stock Management System !</title>
17 <meta http-equiv=
"Content-Type" content="text/html; charset=iso-8859-1">
18 <link rel=
"stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" title="no title" charset="utf-8" />
19         <link rel=
"stylesheet" href="css/template.css" type="text/css" media="screen" title="no title" charset="utf-8" />
20         <script src=
"js/jquery.min.js" type="text/javascript"></script>
21         
22         <script type=
'text/javascript' src='lib/jquery.bgiframe.min.js'></script>
23 <script type=
'text/javascript' src='lib/jquery.ajaxQueue.js'></script>
24 <script type=
'text/javascript' src='lib/thickbox-compressed.js'></script>
25 <script type=
'text/javascript' src='jquery.autocomplete.js'></script>
26 <script type=
'text/javascript' src='localdata.js'></script>
27
28 <link rel=
"stylesheet" type="text/css" href="jquery.autocomplete.css" />
29 <link rel=
"stylesheet" type="text/css" href="lib/thickbox.css" />
30     
31 <script type=
"text/javascript">
32 $().ready(function() {
33
34     function log(
event, data, formatted) {
35         $(
"<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
36     }
37     
38     function formatItem(row) {
39         
return row[0] + " (<strong>id: " + row[1] + "</strong>)";
40     }
41     function formatResult(row) {
42         
return row[0].replace(/(<.+?>)/gi, '');
43     }
44     
45
46
47     $(
"#singleBirdRemote").autocomplete("category.php", {
48         width:
160,
49         autoFill:
true,
50         selectFirst:
false
51     });
52     $(
"#supplier").autocomplete("supplier1.php", {
53         width:
160,
54         autoFill:
true,
55         selectFirst:
false
56     });
57     $(
"#uom").autocomplete("uom.php", {
58         width:
160,
59         autoFill:
true,
60         selectFirst:
false
61     });
62
63
64     $(
"#clear").click(function() {
65         $(
":input").unautocomplete();
66     });
67 });
68
69
70 </script>
71
72 <script LANGUAGE=
"JavaScript">
73 <!--

74 // Nannette Thacker http://www.shiningstar.net

75 function confirmSubmit()
76 {

77 var
agree=confirm("Are you sure you wish to Delete this Entry?");
78 if
(agree)
79     
return true ;
80 else

81     
return false ;
82 }
83
84 function confirmDeleteSubmit()
85 {

86 var
agree=confirm("Are you sure you wish to Delete Seletec Record?");
87 if
(agree)
88     
89 document.deletefiles.submit();

90 else

91     
return false ;
92 }
93
94
95 function checkAll()
96 {
97
98     
var field=document.forms.deletefiles;
99 for
(i = 0; i < field.length; i++)
100     field[i].
checked = true ;
101 }
102
103 function uncheckAll()
104 {
105     
var field=document.forms.deletefiles;
106 for
(i = 0; i < field.length; i++)
107     field[i].
checked = false ;
108 }

109 // -->

110 </script>
111
112
113         <script src=
"js/jquery.validationEngine-en.js" type="text/javascript"></script>
114         <script src=
"js/jquery.validationEngine.js" type="text/javascript"></script>
115          <script src=
"js/jquery.hotkeys-0.7.9.js"></script>
116         <!-- AJAX SUCCESS TEST FONCTION
117             <script>function callSuccessFunction(){alert(
"success executed")}
118                     function callFailFunction(){alert(
"fail executed")}
119             </script>
120         -->
121         
122         <script>
123         
124         
125         
126         
127         
128         $(document).ready(function() {
129             
// SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() },
130              $(
"#name").focus();
131             $(
"#form1").validationEngine(),
132             
133             jQuery(document).bind(
'keydown', 'Ctrl+s',function() {
134           $(
'#form1').submit();
135           
return false;
136             });
137             
138             jQuery(document).bind(
'keydown', 'Ctrl+r',function() {
139           $(
'#form1').reset();
140           
return false;
141             });
142             jQuery(document).bind(
'keydown', 'Ctrl+a',function() {
143             window.location =
"addstock.php";
144           
return false;
145             });
146             jQuery(document).bind(
'keydown', 'Ctrl+0',function() {
147             window.location =
"admin.php";
148           
return false;
149             });
150             jQuery(document).bind(
'keydown', 'Ctrl+1',function() {
151             window.location =
"add_purchase.php";
152               
return false;
153             });
154             jQuery(document).bind(
'keydown', 'Ctrl+2',function() {
155             window.location =
"add_stock_sales.php";
156               
return false;
157             });
158             jQuery(document).bind(
'keydown', 'Ctrl+3',function() {
159             window.location =
"add_stock_details.php";
160               
return false;
161             });
162             jQuery(document).bind(
'keydown', 'Ctrl+4',function() {
163             window.location =
"add_category.php";
164               
return false;
165             });
166             jQuery(document).bind(
'keydown', 'Ctrl+5',function() {
167             window.location =
"add_supplier_details.php";
168               
return false;
169             });
170             jQuery(document).bind(
'keydown', 'Ctrl+6',function() {
171             window.location =
"add_customer_details.php";
172               
return false;
173             });
174             jQuery(document).bind(
'keydown', 'Ctrl+7',function() {
175             window.location =
"view_stock_entries.php";
176               
return false;
177             });
178             jQuery(document).bind(
'keydown', 'Ctrl+8',function() {
179             window.location =
"view_stock_sales.php";
180               
return false;
181             });
182             jQuery(document).bind(
'keydown', 'Ctrl+9',function() {
183             window.location =
"view_stock_details.php";
184               
return false;
185             });
186             
//$.validationEngine.loadValidation("#date")
187             
//alert($("#formID").validationEngine({returnIsValid:true}))
188             
//$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example
189             
//$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS
190         });
191     </script>
192 <style type=
"text/css">
193 <!--
194 body {
195     margin-left: 0px;
196     margin-top: 0px;
197     margin-right: 0px;
198     margin-bottom: 0px;
199     background-color: #FFFFFF;
200 }
201
202 *{
203 padding: 0px;
204 margin: 0px;
205 }
206 #vertmenu {
207 font-family: Verdana, Arial, Helvetica, sans-serif;
208 font-size:
100%;
209 width: 160px;
210 padding: 0px;
211 margin: 0px;
212 }
213
214 #vertmenu h1 {
215 display: block;
216 background-color:#FF9900;
217 font-size:
90%;
218 padding: 3px
0 5px 3px;
219 border: 1px solid #
000000;
220 color: #
333333;
221 margin: 0px;
222 width:159px;
223 }
224
225 #vertmenu ul {
226 list-style: none;
227 margin: 0px;
228 padding: 0px;
229 border: none;
230 }
231 #vertmenu ul li {
232 margin: 0px;
233 padding: 0px;
234 }
235 #vertmenu ul li a {
236 font-size:
80%;
237 display: block;
238 border-bottom: 1px dashed #C39C4E;
239 padding: 5px 0px 2px 4px;
240 text-decoration: none;
241 color: #
666666;
242 width:160px;
243 }
244
245 #vertmenu ul li a:hover, #vertmenu ul li a:focus {
246 color: #
000000;
247 background-color: #eeeeee;
248 }
249 .style1 {color: #
000000}
250 div.pagination {
251
252     padding: 3px;
253
254     margin: 3px;
255
256 }
257
258
259
260 div.pagination a {
261
262     padding: 2px 5px 2px 5px;
263
264     margin: 2px;
265
266     border: 1px solid #AAAADD;
267
268     
269
270     text-decoration: none;
/* no underline */
271
272     color: #
000099;
273
274 }
275
276 div.pagination a:hover, div.pagination a:active {
277
278     border: 1px solid #
000099;
279
280
281
282     color: #
000;
283
284 }
285
286 div.pagination span.current {
287
288     padding: 2px 5px 2px 5px;
289
290     margin: 2px;
291
292         border: 1px solid #
000099;
293
294         
295
296         font-weight: bold;
297
298         background-color: #
000099;
299
300         color: #FFF;
301
302     }
303
304     div.pagination span.disabled {
305
306         padding: 2px 5px 2px 5px;
307
308         margin: 2px;
309
310         border: 1px solid #EEE;
311
312     
313
314         color: #DDD;
315
316     }
317
318     
319 -->
320 </style>
321 </head>
322
323 <body>
324 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
325   <tr>
326     <td align=
"center" valign="top"><table width="960" border="0" cellspacing="0" cellpadding="0">
327       <tr>
328         <td>
329         <table width=
"960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
330           <tr>
331             <td height=
"90" align="left" valign="top"><img src="images/topbanner.jpg" width="960" height="82"></td>
332           </tr>
333           <tr>
334             <td height=
"800" align="left" valign="top"><table width="960" border="0" cellpadding="0" cellspacing="0" bgcolor="#ECECEC">
335               <tr>
336                 <td width=
"130" align="left" valign="top">
337                 
338                 <br>
339
340                 <strong>Welcome <font color=
"#3399FF"><?php echo $_SESSION['username']; ?> !</font></strong><br> <br>
341 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
342   <tr>
343     <td align=
"center"><a href="admin.php"><img src="images/home.png" width="130" height="99" border="0"></a></td>
344     </tr>
345   <tr>
346     <td align=
"center">&nbsp;</td>
347     </tr>
348   <tr>
349     <td align=
"center"><a href="add_purchase.php"><img src="images/purchase.png" width="130" height="124" border="0"></a></td>
350     </tr>
351   <tr>
352     <td align=
"center">&nbsp;</td>
353     </tr>
354   <tr>
355     <td align=
"center"><a href="add_stock_sales.php"><img src="images/sales.png" width="146" height="111" border="0"></a></td>
356     </tr>
357   <tr>
358     <td align=
"center">&nbsp;</td>
359     </tr>
360   <tr>
361     <td align=
"center"><a href="report.php"><img src="images/reports.png" width="131" height="142" border="0"></a></td>
362     </tr>
363   <tr>
364     <td align=
"center">&nbsp;</td>
365     </tr>
366   <tr>
367     <td align=
"center">&nbsp;</td>
368     </tr>
369   <tr>
370     <td align=
"center">&nbsp;</td>
371     </tr>
372 </table>
373
374
375     
376                 
377                 
378                 </td> <td height=
"500" align="center" valign="top">
379 <table width=
"100%" border="0" cellspacing="0" cellpadding="0">
380   <tr>
381     <td><a href=
"add_stock_details.php"><img src="images/addstockdetails.png" width="67" height="62" border="0"></a></td>
382     <td><a href=
"add_supplier_details.php"><img src="images/supplier.png" width="67" height="54" border="0"></a></td>
383     <td><a href=
"add_customer_details.php"><img src="images/customer.png" width="67" height="54" border="0"></a></td>
384     <td><a href=
"add_category.php"><img src="images/categories.png" width="67" height="54" border="0"></a></td>
385     <td><a href=
"view_stock_sales.php"><img src="images/vsales.png" width="67" height="54" border="0"></a></td>
386     <td><a href=
"view_stock_entries.php"><img src="images/vpurchase.png" width="67" height="54" border="0"></a></td>
387     <td><a href=
"view_stock_details.php"><img src="images/stockdetails.png" width="67" height="54" border="0"></a></td>
388     <td><a href=
"view_stock_availability.php"><img src="images/savail.png" width="67" height="54" border="0"></a></td>
389      <td align=
"left" valign="top"><a href="view_customer_details.php"><img src="images/customers.png" width="94" height="22" border="0"></a><br> <a href="view_supplier_details.php"><img src="images/suppliers.png" width="94" height="22" border="0"></a><br>
390       <a href=
"view_payments.php"><img src="images/payments.png" width="94" height="22" border="0"></a></td>
391     <td align=
"left" valign="top"><a href="view_stock_sales_payments.php"><img src="images/outstanding.png" width="94" height="22" border="0"></a><br> <a href="view_stock_entries_payments.php"><img src="images/pendings.png" width="94" height="22" border="0"></a><br>
392       <a href=
"logout.php"><img src="images/logout.png" width="94" height="22" border="0"></a></td>
393   </tr>
394 </table>
395 <br>
396 <br>
397         
398 <table width=
"700" border="0" cellspacing="0" cellpadding="0">
399   <tr>
400     
401     <td><form action=
"" method="get" name="page">
402 Page per Record<input name=
"limit" type="text" style="margin-left:5px;" value="<?php if(isset($_GET['limit'])) echo $_GET['limit']; else echo "10"; ?>" size="3" maxlength="3">
403 <input name=
"go" type="submit" value="Go"><!--
404 <input type=
"button" name="selectall" value="SelectAll" onClick="checkAll()" style="margin-left:5px;"/>
405 <input type=
"button" name="unselectall" value="DeSelectAll" onClick="uncheckAll()" style="margin-left:5px;" />
406 <input name=
"dsubmit" type="button" value="Delete Selected" style="margin-left:5px;" onclick="return confirmDeleteSubmit()"/> --></form></td>
407   </tr>
408 </table>
409                 <?php
410
411
412
413 $SQL =
"SELECT * FROM transactions";
414
415
416     $tbl_name=
"stock_avail"; //your table name
417
418     
// How many adjacent pages should be shown on each side?
419
420     $adjacents =
3;
421
422     
423
424     
/*
425
426        First
get total number of rows in data table.
427
428        If you have a WHERE clause
in your query, make sure you mirror it here.
429
430     */

431
432     $query =
"SELECT COUNT(*) as num FROM stock_avail";
433     $total_pages = mysql_fetch_array(mysql_query($query));
434
435     $total_pages = $total_pages[num];
436
437     
438
439     
/* Setup vars for query. */
440
441     $targetpage =
"view_stock_availability.php"; //your file name (the name of this file)
442
443     $limit =
10; //how many items to show per page
444     
if(isset($_GET['limit']))
445     $limit=$_GET[
'limit'];
446     
447     $page = $_GET[
'page'];
448
449     
if($page)
450
451         $start = ($page -
1) * $limit; //first item to display on this page
452
453     
else
454
455         $start =
0; //if no page var is given, set start to 0
456
457     
458
459     
/* Get data. */
460
461     $sql =
"SELECT * FROM stock_avail ORDER BY id desc LIMIT $start, $limit ";
462     
463     
464     $result = mysql_query($sql);
465
466     
467
468     
/* Setup page vars for display. */
469
470     
if ($page == 0) $page = 1; //if no page var is given, default to 1.
471
472     $prev = $page -
1; //previous page is page - 1
473
474     $next = $page +
1; //next page is page + 1
475
476     $lastpage = ceil($total_pages/$limit);
//lastpage is = total pages / items per page, rounded up.
477
478     $lpm1 = $lastpage -
1; //last page minus 1
479
480     
481
482     
/*
483
484         Now we apply our rules and draw the pagination
object.
485
486         We
're actually saving the code to a variable in case we want to draw it more than once.
487
488     */

489
490     $pagination =
"";
491
492     
if($lastpage > 1)
493
494     {
495
496         $pagination .=
"<div class=\"pagination\">";
497
498         
//previous button
499
500         
if ($page > 1)
501
502             $pagination.=
"<a href=\"$targetpage?page=$prev&limit=$limit\">« previous</a>";
503
504         
else
505
506             $pagination.=
"<span class=\"disabled\">« previous</span>";
507
508         
509
510         
//pages
511
512         
if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up
513
514         {
515
516             
for ($counter = 1; $counter <= $lastpage; $counter++)
517
518             {
519
520                 
if ($counter == $page)
521
522                     $pagination.=
"<span class=\"current\">$counter</span>";
523
524                 
else
525
526                     $pagination.=
"<a href=\"$targetpage?page=$counter&limit=$limit\">$counter</a>";
527
528             }
529
530         }
531
532         elseif($lastpage >
5 + ($adjacents * 2)) //enough pages to hide some
533
534         {
535
536             
//close to beginning; only hide later pages
537
538             
if($page < 1 + ($adjacents * 2))
539
540             {
541
542                 
for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
543
544                 {
545
546                     
if ($counter == $page)
547
548                         $pagination.=
"<span class=\"current\">$counter</span>";
549
550                     
else
551
552                         $pagination.=
"<a href=\"$targetpage?page=$counter&limit=$limit\">$counter</a>";
553
554                 }
555
556                 $pagination.=
"...";
557
558                 $pagination.=
"<a href=\"$targetpage?page=$lpm1&limit=$limit\">$lpm1</a>";
559
560                 $pagination.=
"<a href=\"$targetpage?page=$lastpage&limit=$limit\">$lastpage</a>";
561
562             }
563
564             
//in middle; hide some front and some back
565
566             elseif($lastpage - ($adjacents *
2) > $page && $page > ($adjacents * 2))
567
568             {
569
570                 $pagination.=
"<a href=\"$targetpage?page=1&limit=$limit\">1</a>";
571
572                 $pagination.=
"<a href=\"$targetpage?page=2&limit=$limit\">2</a>";
573
574                 $pagination.=
"...";
575
576                 
for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
577
578                 {
579
580                     
if ($counter == $page)
581
582                         $pagination.=
"<span class=\"current\">$counter</span>";
583
584                     
else
585
586                         $pagination.=
"<a href=\"$targetpage?page=$counter&limit=$limit\">$counter</a>";
587
588                 }
589
590                 $pagination.=
"...";
591
592                 $pagination.=
"<a href=\"$targetpage?page=$lpm1&limit=$limit\">$lpm1</a>";
593
594                 $pagination.=
"<a href=\"$targetpage?page=$lastpage&limit=$limit\">$lastpage</a>";
595
596             }
597
598             
//close to end; only hide early pages
599
600             
else
601
602             {
603
604                 $pagination.=
"<a href=\"$targetpage?page=1&limit=$limit\">1</a>";
605
606                 $pagination.=
"<a href=\"$targetpage?page=2&limit=$limit\">2</a>";
607
608                 $pagination.=
"...";
609
610                 
for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
611
612                 {
613
614                     
if ($counter == $page)
615
616                         $pagination.=
"<span class=\"current\">$counter</span>";
617
618                     
else
619
620                         $pagination.=
"<a href=\"$targetpage?page=$counter&limit=$limit\">$counter</a>";
621
622                 }
623
624             }
625
626         }
627
628         
629
630         
//next button
631
632         
if ($page < $counter - 1)
633
634             $pagination.=
"<a href=\"$targetpage?page=$next&limit=$limit\">next »</a>";
635
636         
else
637
638             $pagination.=
"<span class=\"disabled\">next »</span>";
639
640         $pagination.=
"</div>\n";
641
642     }
643
644
645 ?>
646 <?php
if(isset($_GET['msg'])) echo "Record ID:[ ".$_GET['id']." ] <center>".$_GET['msg']."</center>";
647                     
648                     
if(isset($_GET['cmsg'])) echo "<center>".$_GET['cmsg']."</center>";
649                     ?>
650
651
652       
653      <form name=
"deletefiles" action="deleteselected.php" method="post">
654      <input name=
"table" type="hidden" value="stock_entries">
655      <input name=
"return" type="hidden" value="view_stock_entries.php">
656
657
658       <table width=
"700" border="0" cellspacing="0" cellpadding="0">
659
660       <tr>
661
662         <td bgcolor=
"#0099FF"><div align="center"><strong><span class="style1">View Stock Sales Payments </span></strong></div></td>
663
664       </tr>
665
666       <tr>
667
668         <td>&nbsp;</td>
669
670       </tr>
671
672       <tr>
673
674         <td align=
"center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
675
676           <tr>
677
678             <td width=
"100"><strong>ID</strong></td>
679
680             <td width=
"100"><strong>Stock Name</strong></td>
681
682             <td width=
"100"><strong>Available Quantity</strong></td>
683             <!-- <td width=
"100"><strong>Expiry</strong></td> -->
684               
685            <!-- <td width=
"100"><strong>View/Edit</strong></td> -->
686             <!-- <td width=
"100"><strong>Select</strong></td> -->
687           </tr>
688
689           
690
691           
692
693           <?php
694
695      
696
697                                 
while($row = mysql_fetch_array($result))
698
699         {
700             
701
702                                          ?>
703
704                                             <tr>
705
706
707
708         <td width=
"100"><?php echo $row['id']; ?></td>
709         <td width=
"100"><?php echo $row['name']; ?></td>
710          <td width=
"100"><?php echo $row['quantity']; ?></td>
711           
712             
713         
714 <!-- <td width=
"100"> <a href="update_stock_entries.php?id=<?php// echo $entryid;?>"><img src="images/edit-icon.png" border="0" alt="delete"></a></td>
715  -->
716                             <!-- <td width=
"100">&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" value="<?php // echo $row['id']; ?>" name="checklist[]" /></td>
717  --> </tr>
718
719
720                         
721
722                                              
723
724                                              
725
726                                         
727
728                                              
729
730                                              <?php
731
732                                                 
733
734                                              
735
736                                       }
737
738                                         
739
740                       
741
742                           
743
744     
745
746  
747
748
749
750 ?>
751
752           
753
754           
755
756           
757
758           
759
760           
761
762         </table></td>
763
764       </tr>
765
766       <tr>
767
768         <td>&nbsp;</td>
769
770       </tr>
771
772       <tr>
773
774         <td align=
"center">&nbsp;</td>
775
776       </tr>
777
778       <tr>
779
780         <td align=
"center"><div style="margin-left:20px;"><?php echo $pagination; ?></div></td>
781
782       </tr>
783
784       <tr>
785
786         <td align=
"center">&nbsp;</td>
787
788       </tr>
789
790       <tr>
791
792         <td>&nbsp;</td>
793
794       </tr>
795
796       <tr>
797
798         <td align=
"center">&nbsp; </td>
799
800       </tr>
801
802       <tr>
803
804         <td>&nbsp;</td>
805
806       </tr>
807
808     </table>
809
810     
811
812     </form>
813
814     
815
816     </td>
817
818   </tr>
819
820 </table>
821
822 </td>
823               </tr>
824             </table>
825             
826         </td>
827           </tr>
828           <tr>
829             <td height=
"30" align="center" bgcolor="#72C9F4"><span class="style1"><a href="http://www.pluskb.com">Developed by PlusKB Innovations</a></span></td>
830           </tr>
831         </table></td>
832       </tr>
833     </table></td>
834   </tr>
835 </table>
836
837 </body>
838 </html>
839 <?php
840 }
841 ?>


Gõ tìm kiếm nhanh...